﻿@model HdipCricketClub.ViewModels.ScorecardAbandonedFixtureEnterScoresBatAndBowlViewModel

@{
    ViewBag.Title = "EnterCompletedFixtureScoresBattedSecond";
}

<h2>Enter Completed Fixture Scores, BattedSecond</h2>

@using (@Html.BeginForm("UpdateScoresBattedSecond", "ScorecardCompletedFixture", FormMethod.Post))
{
<fieldset>
<legend>Fixture</legend>
<br/>
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.fixture_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.team_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.opponent_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.type)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.home)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.date)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.start_time)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.no_of_players)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.fixture_id)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.result_id)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.scorecard_entered)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.won_toss)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted_first)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.bowled)

@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.name)
vs @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.team_name)
<br/>
Played on: @Html.DisplayFor(ModelItem => Model.ScorecardFixture.date)
<br/>
At:
@if (Model.ScorecardFixture.home)
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
}
else
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
}
<br/><br/>
@if (Model.ScorecardHeaderDetail.won_toss)
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
    @:won the toss and elected to bat.
}
else
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
    @:won the toss and elected to field first.
}
</fieldset>

<fieldset>
<legend>Innings of @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)</legend>
<br/>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            How Out
        </th>
        <th>
            Fielder
        </th>
        <th>
            Bowler
        </th>
        <th>
            Runs
        </th>
    </tr>
    @foreach (var item in Model.OpponentBatsmen)
    {
        <tr>
                @Html.HiddenFor(modelItem => item.op_fixture_id)
                @Html.HiddenFor(modelItem => item.op_batsman_number)
                @Html.HiddenFor(modelItem => item.op_player_name)
            <td>
                @Html.DisplayFor(modelItem => item.op_batsman_number)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.op_player_name)
            </td>
            <td>
                @Html.DropDownListFor(modelitem => item.op_how_out, Model.DismissalTypeSelectList, string.Empty)
            </td>
            <td>
                @Html.DropDownListFor(modelItem => item.op_fielder_name, Model.ClubPlayerSelectList, string.Empty)
            </td>
            <td>
                @Html.DropDownListFor(modelItem => item.op_bowler_name, Model.ClubBowlerSelectList, string.Empty)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.op_batting_runs)
            </td>
        </tr>
    }
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Byes:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.OpponentOtherDetail.byes)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Leg Byes:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.OpponentOtherDetail.leg_byes)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Wides:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.OpponentOtherDetail.wides)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            No Balls:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.OpponentOtherDetail.no_balls)
        </td>
    </tr>
</table>
<br/>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Runs:
        </th>
        <th>
            Wickets:
        </th>
    </tr>
    @foreach (var item in Model.ClubBowlers)
    {
    <tr>
            @Html.HiddenFor(modelItem => item.fixture_id)
            @Html.HiddenFor(modelItem => item.player_id)
            @Html.HiddenFor(modelItem => item.bowler_number)
        <td>
            @Html.DisplayFor(modelItem => item.bowler_number)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)   
        </td>
        <td>
            @Html.EditorFor(modelItem => item.overs)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.maidens)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.bowling_runs)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.wickets)
        </td>
    </tr>
    }
</table>
</fieldset>
    <fieldset>
<legend>Innings of @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)</legend>
<br/>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            How Out
        </th>
        <th>
            Fielder
        </th>
        <th>
            Bowler
        </th>
        <th>
            Runs
        </th>
    </tr>
    @foreach (var item in Model.ClubBatsmen)
    {
        <tr>
                @Html.HiddenFor(modelItem => item.fixture_id)
                @Html.HiddenFor(modelItem => item.player_id)
                @Html.HiddenFor(modelItem => item.batsman_number)
            <td>
                @Html.DisplayFor(modelItem => item.batsman_number)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)
            </td>
            <td>
                @Html.DropDownListFor(modelitem => item.how_out, Model.DismissalTypeSelectList, string.Empty)
            </td>
            <td>
                @Html.DropDownListFor(modelItem => item.fielder_name, Model.OpponentPlayerSelectList, string.Empty)
            </td>
            <td>
                @Html.DropDownListFor(modelItem => item.bowler_name, Model.OpponentBowlerSelectList, string.Empty)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.batting_runs)
            </td>
        </tr>
    }
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Byes:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.ClubOtherDetail.byes)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Leg Byes:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.ClubOtherDetail.leg_byes)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            Wides:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.ClubOtherDetail.wides)
        </td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>
            No Balls:
        </td>
        <td></td>
        <td>
            @Html.EditorFor(ModelItem => Model.ClubOtherDetail.no_balls)
        </td>
    </tr>
</table>
<br/>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Runs:
        </th>
        <th>
            Wickets:
        </th>
    </tr>
    @foreach (var item in Model.OpponentBowlers)
    {
    <tr>
            @Html.HiddenFor(modelItem => item.op_fixture_id)
            @Html.HiddenFor(modelItem => item.op_batsman_number)
            @Html.HiddenFor(modelItem => item.op_bowler_number)
            @Html.HiddenFor(modelItem => item.op_player_name)
        <td>
            @Html.DisplayFor(modelItem => item.op_bowler_number)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.op_player_name)   
        </td>
        <td>
            @Html.EditorFor(modelItem => item.op_overs)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.op_maidens)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.op_bowling_runs)
        </td>
        <td>
            @Html.EditorFor(modelItem => item.op_wickets)
        </td>
    </tr>
    }
</table>
</fieldset>
   <p>
        <input type="submit" value="Submit" />
   </p>   
}